#ifndef _SKELETON_H_
#define _SKELETON_H_

#include "AskalExport.h"
#include "april/RenderSystem.h"
#include "hltypes/hstring.h"
#include "hltypes/hmap.h"
#include "Bone.h"
#include "gtypes/Quaternion.h"

namespace askal
{
	struct AskalExport Keyframe
	{
		hstr mGroupName, mAnimationName;
		float mTime;
		gquat mQuaternion;
		gvec3 mPos;
	};
	
	struct AskalExport Animation
	{
		hstr mAnimationName;
		hmap<hstr, harray<Keyframe> > mActions;
		float mDefaultDuration;
	};
	
	enum RotationInterpolationMode
	{
		RIM_NLERP = 0, // 2do
		RIM_SLERP = 1
	};
	
	enum SkinningMode
	{
		SM_SMOOTH_SKINNING = 0,
		SM_DUAL_QUATERNION_SKINNING = 1 // 2do
	};

	class AskalExport Skeleton
	{
		
		bool _mVisible; // in case we want to see the skeleton
		askal::RotationInterpolationMode _mRIM;
		askal::SkinningMode _mSM;
		
	public:
		
		harray<askal::Bone> mBones;
		hmap<hstr, askal::Animation> mAnimations;
		hstr mName;
		
		Skeleton();
		~Skeleton();
		
		void addBone(askal::Bone);
		Bone* getBone(chstr name);
		int getBoneIndex(chstr name);
		
		void setVisible(bool visible);
		void setRotationInterpolationMode(askal::RotationInterpolationMode mode);
		void setSkiningMode(askal::SkinningMode);
		
		Animation* getAnimation(chstr name);
	};

}

#endif // _SKELETON_H_
